#!/bin/bash

basedir=$(pwd)
cd ../dependents
depdir=$(pwd)

cd ${depdir}

MAVEN_HOME=${depdir}/apache-maven-3.5.0
if [ ! -d "$MAVEN_HOME" ] ; then
  tar -xf apache-maven-3.5.0-bin.tar.gz
fi

JAVA_HOME=${depdir}/jdk1.8.0_141
if [ ! -d "$JAVA_HOME" ] ; then
  tar -xf jdk-8u141-linux-x64.tar.gz
fi

PATH=${PATH}:${MAVEN_HOME}/bin:${JAVA_HOME}/bin
####################################

cd ${basedir}/code
./package.sh
./deploy.sh

echo ok